{% extends "admin/base.html" %}
{% block content %}
    <script type="text/javascript">
        var primary_menu = "menu_0";
        var sub_menu = "menu_0_0";
    </script>
    <div class="col-md-12">
        <div class="panel panel-primary">
            <div class="panel-heading">
                <div class="panel-title"><h3>园区基本信息</h3></div>
            </div>
            <div class="panel-body">
                <div class="row">
                    <div class="col-md-12">
                        <form role="form" action="/admin/submitEidtPark/" method="post" enctype="multipart/form-data" class="form-horizontal form-groups-bordered">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">用户名</label>
                                <div class="col-sm-5">
                                    <input type="text" name="username" value="{{ user_admin.username }}" class="form-control"  placeholder="请输入登陆用户名" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">密码</label>
                                <div class="col-sm-5">
                                    <input type="text" name="password" value="{{ user_admin.password }}" class="form-control"  placeholder="请输入登陆密码" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">园区名称</label>
                                <div class="col-sm-5">
                                    <input type="hidden" name="park_id" value="{{ user_admin.park.id }}"/>
                                    <input type="hidden" name="user_id" value="{{ user_admin.id }}"/>
                                    <input type="text" name="name" value="{{ user_admin.park.name }}" class="form-control"  placeholder="请输入园区名称" />
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-3 control-label">园区地址</label>
                                <div class="col-sm-5">
                                    <input type="text" name="address" value="{{ user_admin.park.address }}" class="form-control"  placeholder="请输入园区名称" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">园区级别</label>
                                <div class="col-sm-5">
                                    <input type="text" name="rank" value="{{ user_admin.park.rank }}" class="form-control"  placeholder="请输入园区名称" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">建立时间</label>
                                <div class="col-sm-5">
                                    <input type="text" name="create_time" value="{{ user_admin.park.create_time }}" class="form-control"  placeholder="请输入建立时间" />
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-3 control-label">主要产业类型</label>
                                <div class="col-sm-5">
                                    <input type="text" name="production_type" value="{{ user_admin.park.production_type }}" class="form-control"
                                           placeholder="请输入主要产业类型" />
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">园区面积</label>
                                <div class="col-sm-5">
                                    <input datatype="n" type="text" name="area" value="{{ user_admin.park.area }}" class="form-control"
                                           placeholder="请输入主要产业类型" />
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-3 control-label">园区简介</label>
                                <div class="col-sm-5">
                                    <textarea type="text" name="info"  class="form-control" cols="20"
                                           placeholder="请输入园区简介" >{{ user_admin.park.info }}</textarea>
                                </div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-offset-3 col-sm-5">
                                    <input type="submit" class="btn btn-success btn-lg" value="保存">
                                    <input class="btn btn-info btn-lg" type="reset" value="重置"/>
                                </div>
                            </div>

                        </form>
                    </div>
                </div>
            </div>
        </div>

    </div>
{% endblock %}

{% block js %}
    <script language="javascript">
        var dizhi = "{{basic.facilities_add0}}";
        $(function(){
            var flag = $("input[name='parent_company']:checked").val();
            if (flag==1) {
                $(".parentCompany").show();
                $(".parentCompany").eq(0).find("input").attr("datatype","*");
                $(".parentCompany").eq(1).find("input").attr("datatype","n");
            }else{
                $(".parentCompany").hide().find("input").removeAttr('datatype');
            }
            $("input[name='parent_company']").click(function(){
                var flag = $("input[name='parent_company']:checked").val();
                console.log(flag)
                if (flag==1) {
                    $(".parentCompany").show();
                    $(".parentCompany").eq(0).find("input").attr("datatype","*");
                    $(".parentCompany").eq(1).find("input").attr("datatype","n");
                }else{
                    $(".parentCompany").hide().find("input").removeAttr('datatype');
                }
            })

        });
        function getNextElement (field) {
            var form = field.form;
            for (var e = 0; e < form.elements.length; e++)
                if (field == form.elements[e])
                    break;
            return form.elements[++e % form.elements.length];
        }



    </script>
{% endblock %}
